package com.example;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.nio.file.Paths;
import java.util.Collections;

public class Main {

    static void generate() {
        FastAutoGenerator.create("jdbc:oracle:thin:@192.168.5.5:1521:dev", "SVC_PRO_LYS", "SVC_PRO_LYS")
                .globalConfig(builder -> builder
                        .author("Baomidou")
                        .outputDir(Paths.get(System.getProperty("user.dir")) + "/code-generator/src/main/java")
                        .commentDate("yyyy-MM-dd")
                )
                .packageConfig(builder -> builder
                        .parent("com.example")
                        .entity("entity")
                        .mapper("mapper")
                        .service("service")
                        .serviceImpl("service.impl")
                        .pathInfo(Collections.singletonMap(OutputFile.xml, Paths.get(System.getProperty("user.dir")) + "/code-generator/src/main/resources/mapper"))
                )
                .strategyConfig(builder -> builder
                        .addInclude("MEMBER_BIZ_DATA")
                        .serviceBuilder()
                        .formatServiceFileName("%sService")
                        .entityBuilder()
                        .enableLombok()
                )
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }
    public static void main(String[] args) {
        generate();
        //System.out.println(Paths.get(System.getProperty("user.dir")));
    }

}